# Maintainer: Oliver Galvin <odg at riseup dot net>

_pkgbase=tubeman
pkgbase="$_pkgbase"-git
pkgname=( "$_pkgbase"{,-gtk}-git )
pkgver=r1
pkgrel=1
arch=('x86_64' 'i686' 'arm7h')
pkgdesc="Local YouTube subscription manager and browser"
url="https://notabug.org/odg/$_pkgbase"
license=(GPL3)
makedepends=(curl git gtk3 ncurses sqlite)
source=("${_pkgbase}::git+${url}.git")
sha512sums=('SKIP')

build() {
        cd "$_pkgbase"
	./bootstrap
        ./configure --prefix=/usr
        make
}

package_tubeman-git() {
	depends=(curl ncurses sqlite)
	optdepends=('w3m: thumbnail support')
	conflicts=("$_pkgbase")
	provides=("$_pkgbase")
	cd ${_pkgbase}/src
	make DESTDIR="$pkgdir" install
}

package_tubeman-gtk-git() {
	pkgdesc+=" - GTK frontend"
	depends=(gtk3 "$_pkgbase")
	conflicts=("${_pkgbase}-gtk")
	provides=("${_pkgbase}-gtk")
	cd ${_pkgbase}/gtk
	make DESTDIR="$pkgdir" install
}

check() {
        cd "$_pkgbase"
        make check
}

pkgver() {
	cd "$_pkgbase"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
